﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UniversitySolution
{
    class Student

    // вводишь значение кафедры - выводишь всех студентов кафедры


    {
        public string firstName;
        public string surName;
        public DateTime dateOfBirth;
        public List<int> Marks = new List<int>();


        public void PrintStudentMarksToConsole()
        {
            foreach (var mark in Marks)
            {
                Console.WriteLine(mark);
            }
        }

        public void PrintStudentInfoToConsole()

        {
            Console.WriteLine("First name: {0}, Surname: {1}, Birthday: {2}", firstName, surName, dateOfBirth.ToString("dd/MM/yyyy"));
            //Console.WriteLine("Surname: {0}", surName);
            //Console.WriteLine("Birthday: {0}", dateOfBirth.ToString("dd/MM/yyyy"));
        }

        public void GenerateRandomStudentParameters()
        {
            firstName = "Vasya";
            surName = Student.StudentCount.ToString();
            dateOfBirth = new DateTime(Student.rndGenerator.Next(1990, 2012), Student.rndGenerator.Next(1, 13), Student.rndGenerator.Next(1, 29));

            for (int i = 0; i < 15; i++)
            {
                int mark = Student.rndGenerator.Next(1, 100);
                Marks.Add(mark);
            }
        }

        public static Student GenerateRandomStudent()
        {
            Student.StudentCount++;
            Student student = new Student();
            student.firstName = "Vasya";
            student.surName = "Pupkin" + Student.StudentCount.ToString();
            student.dateOfBirth = new DateTime(Student.rndGenerator.Next(1990, 2012), Student.rndGenerator.Next(1, 13), Student.rndGenerator.Next(1, 29));

            for (int i=0; i < 5; i++)
            {
                int mark = Student.rndGenerator.Next(1, 100);
                student.Marks.Add(mark);
            }
            return student;
        }

        public static Random rndGenerator = new Random();

        public static int StudentCount;

        public double CalculateAvgMark()
        {
            return Marks.Average();
        }

    }
}
